package com.wave.gate.util;

import java.net.InetAddress;

public class PingUtil {
    public static boolean ping(String ipAddress) throws Exception {
        int  timeOut =  500;  //超时应该在1钞以上
        return InetAddress.getByName(ipAddress).isReachable(timeOut);
    }

    public static void main(String[] args) throws Exception {
        long l = System.currentTimeMillis();
        System.out.println(ping("192.168.24.117"));
        System.out.println( System.currentTimeMillis() - l + "ms");
    }
}
